<template>
	<view class="products-page">
		<hsb-core-models
			ref="coreModels"
			:options="options"
			@search="toSearch"
			@product="toEvaluate"
		/>
	</view>
</template>

<script>
export default {
	data () {
		return {
			options: {}
		}
	},
	methods: {
		toSearch () {
			uni.navigateTo({
				url: '/pages/search/index'
			})
		},
		toEvaluate (productInfo) {
			if (!productInfo.productId) return
			uni.navigateTo({
				url: `/pages/evaluate/index?productId=${productInfo.productId}`
			})
		}
	},
	onLoad (options) {
		this.options = options
		// this.$nextTick(() => {
		// 	this.$refs.coreModels.initModels(options)
		// })
	}
}
</script>

<style lang="scss" scoped>
.products-page {
	height: 100%;
}
</style>
